<?php
namespace Api;
class CategoryService{
	function lists(){
        $categoryM = new CategoryModel();
        $categoryData = $categoryM->lists();
        $data = array();
        $categoryList = array();
        foreach ($categoryData as $key=>$items) {
            if( isset($items['parent']) ){
                // echo $categoryList[$items['parent']] . "<br>";
                $data[ $categoryList[$items['parent']] ]['children'][] = $items;
            } else {
                $data[$key] = $items;
                $categoryList[$items['id']] = $key;
            }
        }
        return $data;
        $data = array(
            "首页" => array(),
            "机构设置" => array("机构设置"),
            "工作职责" => array("工作职责","岗位职责"),
            "工作计划" => array("工作计划"),
            "办事流程" => array("办事流程"),
            "教育管理" => array("学生手册","学生手册","工作计划","学生奖励","学风建设","宣传教育","规章制度","信息管理"),
            "助学奖贷" => array("国家奖(助)学金","国家助学贷款","勤工助学","勤工助学中心"),
            "招生就业" => array("招生信息网","招生信息网","就业服务网","毕业生档案查询"),
            "心海导航" => array("心海导航")
        );
        return $data;
	}
}